import React, { Component } from 'react'

export default class Far extends Component {
  state = {
    c: 0,
  }
  // 组件的状态是由外部传入props数据决定
  static getDerivedStateFromProps(props, state) {
    console.log(props, state)
    return {
      c: props.xxx,
    }
  }
  render() {
    return <div>far,{this.state.c}</div>
  }
}
